﻿using JESAI.HttpRequestMonitor.Collector.Grpc;
using JESAI.HttpRequestMonitor.Core.Abstracts;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class DependencyInjectionExtensions
    {
        public static IHttpRequestMonitorBuilder AddHttpRequestMonitorGrpcCollector(this IHttpRequestMonitorBuilder builder)
        {
            builder.Services.AddGrpc();
            return builder;
        }

        public static GrpcServiceEndpointConventionBuilder MapHttpRequestMonitorGrpcCollector(this IEndpointRouteBuilder builder)
        {
            return builder.MapGrpcService<GrpcCollectorService>();
        }
    }
}